/*
 ============================================================================
 Name		: DepositForm.cpp
 Author	  : Vanderson Rodrigues
 Version	 : 1.0
 Copyright   : Your copyright notice
 Description : CDepositForm implementation
 ============================================================================
 */

#include <aknform.h> 
#include <eikedwin.h> 
#include <e32cmn.h>
#include "DepositForm.h"

CDepositForm::CDepositForm()
{
    // No implementation required
}

CDepositForm::~CDepositForm()
{
}

CDepositForm* CDepositForm::NewLC()
{
    CDepositForm* self = new ( ELeave ) CDepositForm();
    CleanupStack::PushL( self );
    self->ConstructL();
    return self;
}

CDepositForm* CDepositForm::NewL()
{
    CDepositForm* self = CDepositForm::NewLC();
    CleanupStack::Pop(); // self;
    return self;
}

void CDepositForm::ConstructL()
{
    CAknForm::ConstructL();

    if( IsEditable() )
    {
        User::InfoPrint( _L(" Form is in the edit mode") ); // Form is in the edit mode //
    }
    else
    {
        User::InfoPrint( _L(" Form is not in the edit mode ") );
        // Form is not in the edit mode //
    }
}

/**
 * Called by the framework whenver the 'Save' menu item is selected, and by the
 * QuerySaveChangesL method when the user answers yes to the save query.
 * Saves the data from the forms controls.
 * @return TBool ETrue if the form data has been saved, EFalse otherwise.
 */

TBool CDepositForm::SaveFormDataL()
{

    CEikEdwin* nEditor = static_cast<CEikEdwin*> ( ControlOrNull( 1 ) );
    if( nEditor )
    {
        // Save the value of Control to class member //
    }

    return ETrue;
}

/**
 * Called when the form is  executed and when the user chooses to discard changes
 * in QuerySaveChangesL (via  DoNotSaveFormDataL).
 */
void CDepositForm::LoadFormValuesFromDataL()
{
    CEikEdwin* nEditor = static_cast<CEikEdwin*> ( ControlOrNull( 1 ) );
    if( nEditor )
    {
        // Example : set the Control Text //
        TBuf<50> myName;
        myName.Copy( _L("Aluguel"));
        HBufC* name = myName.AllocLC();
        // Setting the Value //

        nEditor->SetTextL( name );
        //CleanupStack::PopAndDestroy(name);
    }
}

/**
 * Called by QuerySaveChangeL when the user chooses to discard changes made to 
 * the form. Loads the form values from iOpponent
 */

void CDepositForm::DoNotSaveFormDataL()
{
    LoadFormValuesFromDataL();
}

/**
 * Called by the framework before the form is initialised
 * Loads the form values from iOpponent ready for execution of the form
 */
void CDepositForm::PreLayoutDynInitL()
{
    CAknForm::PreLayoutDynInitL();
    LoadFormValuesFromDataL();
}

// 
///**
//* Called by the framework when a menu is displayed.
//* Removes the default items from the options menu of the form for editing a
//* fields label, adding a field and deleting a field
//*/
// 
//void CDepositForm ::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
//    {
//    CAknForm::DynInitMenuPaneL(aResourceId,aMenuPane);
// 
//    if (aResourceId == R_INPUTDATAVIEW_MENU)
//        {
//        aMenuPane->SetItemDimmed(EAknFormCmdLabel, ETrue);
//        aMenuPane->SetItemDimmed(EAknFormCmdAdd, ETrue);
//        aMenuPane->SetItemDimmed(EAknFormCmdDelete, ETrue);
//        }
//    }

